package day06;

import java.util.Arrays;

public class MethodDemo {
    public static void main(String[] args) {
        sayHi("诸葛村夫");
        sayHello("皓首匹夫！苍髯老贼！", 76);
        sayHello("无耻老贼！断脊之犬！", 88);

        int a = 3, b = 4;
        int sum = plus(a, b);
        System.out.println(sum);

        int[] c =testArray(5,100);
        System.out.println("升序前");
        for (int i = 0; i <c.length ; i++) {
            System.out.print(c[i]+"\t");
        }
        System.out.println("");

        System.out.println("升序后");
        Arrays.sort(c);
        for (int i = 0; i <c.length ; i++) {
            System.out.print(c[i]+"\t");
        }
        System.out.println("");

        int[] d=testArray(6,20);

        aMthod();





    }


    public static  int[] testArray(int len,int range){
        int[] arr =new int[len];
        for (int i = 0; i <arr.length ; i++) {
            arr[i]=(int)(Math.random()*(range+1));//填充随机数
        }
        return arr;
    }

    public static int plus(int num1, int num2) {
        int num = num1 + num2;
        return num;
    }

    public static void sayHello(String name, int age) {
        if (age>80){
            return;
        }
        System.out.println("住口！" + name + "你枉活" + age+"!");
    }

    public static void sayHi(String name) {//方法不放入main中，则不执行
        System.out.println(name + "，你敢！？");
    }

    public static void aMthod (){
        System.out.println(111);
        bMethod();

    }
    public static void bMethod (){
        System.out.println(444);

    }

}
